#pragma once

#include <stdbool.h>
#include "esp_err.h"
#include "esp_lcd_types.h"
#include "esp_lcd_panel_st7735_commands.h"

// LCD vendor specific initialization command info
typedef struct {
    int lcd_cmd;
    const void* param;
    size_t param_size;
    int delay_ms;
} st7735_init_command_t;

typedef struct {
    const st7735_init_command_t* init_commands;
    uint16_t init_commands_count;
} st7735_vendor_config_t;

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Create LCD panel for model ST7735s
 *
 * @param[in] io LCD panel IO handle
 * @param[in] panel_dev_config general panel device configuration
 * @param[out] ret_panel Returned LCD panel handle
 * @return
 *          - ESP_ERR_INVALID_ARG   if parameter is invalid
 *          - ESP_ERR_NO_MEM        if out of memory
 *          - ESP_OK                on success
 */
esp_err_t esp_lcd_new_panel_st7735(
    const esp_lcd_panel_io_handle_t io,
    const esp_lcd_panel_dev_config_t* panel_dev_config,
    esp_lcd_panel_handle_t* ret_panel
);

/**
 * @brief Fill rectangle on LCD panel with color specified
 *
 * @note Combined with `esp_lcd_panel_swap_xy()`, one can realize screen rotation
 *
 * @param[in] panel LCD panel handle, which is created by other factory API like `esp_lcd_new_panel_st77xx()`
* @return
 *          - ESP_OK on success
 */
esp_err_t esp_lcd_new_panel_st7735_flush(esp_lcd_panel_handle_t panel);

#ifdef __cplusplus
}
#endif
